using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Serialization;
using System.Linq.Expressions;
using System.Text.RegularExpressions;

namespace ARR.Entities.ComponentModel
{
    [Serializable]
    public abstract class ValidationBase
    {
        private string _errorMessage;
        private string _propertyName;



        public ValidationBase(string propertyName, string errorMessage)
        {
            this.ErrorMessage = errorMessage;
            this.PropertyName = propertyName;
        }
        

        public virtual string ErrorMessage
        {
            get { return _errorMessage; }
            protected set { _errorMessage = value; }
        }

        public virtual string PropertyName
        {
            get { return (_propertyName ?? string.Empty).Trim(); }
            protected set { _propertyName = value; }
        }




        public override int GetHashCode()
        {
            return this.ToString().GetHashCode();
        }

        public override string ToString()
        {
            return this.ErrorMessage;
        }

        public abstract bool Validate(ValidatableEntity entity);
    }
}
